inherited fmAddCommonBN: TfmAddCommonBN
  Left = 443
  Top = 110
  Width = 1197
  Height = 886
  Caption = #1044#1086#1073#1072#1074#1080#1090#1100' '#1087#1083#1072#1090#1077#1078' '#1073'/'#1085#1072#1083'.'
  Constraints.MinHeight = 886
  Constraints.MinWidth = 1197
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 821
    Width = 1181
  end
  inherited Panel1: TPanel
    Width = 1181
    object DBText1: TDBText [0]
      Left = 96
      Top = 10
      Width = 121
      Height = 17
      DataField = 'BPDATAPOSTUPILO'
      DataSource = DataSourceAllPoruch
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Label13: TLabel [1]
      Left = 8
      Top = 12
      Width = 77
      Height = 13
      Caption = #1044#1072#1090#1072' '#1087#1083#1072#1090#1077#1078#1072':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    inherited BitBtn1: TBitBtn
      Left = 1010
    end
    inherited BitBtn2: TBitBtn
      Left = 1098
    end
  end
  object Panel4: TPanel [2]
    Left = 0
    Top = 45
    Width = 1181
    Height = 396
    Align = alTop
    TabOrder = 3
    object Label18: TLabel
      Left = 10
      Top = 214
      Width = 58
      Height = 13
      Caption = #1050#1090#1086' '#1087#1083#1072#1090#1080#1090
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label3: TLabel
      Left = 9
      Top = 157
      Width = 92
      Height = 13
      Align = alCustom
      Caption = #1055#1086#1083#1091#1095#1072#1090#1077#1083#1100' '#1091#1089#1083#1091#1075
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label5: TLabel
      Left = 8
      Top = 10
      Width = 64
      Height = 13
      Caption = #1055#1083#1072#1090#1077#1083#1100#1097#1080#1082
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label6: TLabel
      Left = 8
      Top = 88
      Width = 107
      Height = 13
      Caption = #1053#1072#1079#1085#1072#1095#1077#1085#1080#1077' '#1087#1083#1072#1090#1077#1078#1072
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label7: TLabel
      Left = 792
      Top = 28
      Width = 25
      Height = 13
      Caption = #1048#1053#1053':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object DBText4: TDBText
      Left = 824
      Top = 26
      Width = 89
      Height = 17
      DataField = 'BPPLATINN'
      DataSource = DataSourceAllPoruch
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label8: TLabel
      Left = 792
      Top = 49
      Width = 25
      Height = 13
      Caption = #1050#1055#1055':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object DBText5: TDBText
      Left = 824
      Top = 47
      Width = 105
      Height = 17
      DataField = 'BPPLATKPP'
      DataSource = DataSourceAllPoruch
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label9: TLabel
      Left = 792
      Top = 69
      Width = 29
      Height = 13
      Caption = #1057#1095#1077#1090':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object DBText7: TDBText
      Left = 824
      Top = 67
      Width = 161
      Height = 17
      DataField = 'BPPLATSCHET'
      DataSource = DataSourceAllPoruch
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label11: TLabel
      Left = 106
      Top = 282
      Width = 51
      Height = 13
      Caption = #1044#1086#1075#1086#1074#1086#1088#1099
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label12: TLabel
      Left = 680
      Top = 210
      Width = 123
      Height = 13
      Caption = #1054#1073#1088#1072#1079#1086#1074#1072#1090#1077#1083#1100#1085#1086#1077' '#1087#1086#1076#1088'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object cxRadioGroup1: TcxRadioGroup
      Left = 8
      Top = 228
      Properties.DefaultValue = 2
      Properties.Items = <
        item
          Caption = #1060#1080#1079'. '#1083#1080#1094#1086
          Value = 2
        end
        item
          Caption = #1070#1088'. '#1083#1080#1094#1086
          Value = 3
        end>
      Properties.ReadOnly = False
      Properties.OnChange = cxRadioGroup1PropertiesChange
      ItemIndex = 0
      TabOrder = 1
      Height = 57
      Width = 89
    end
    object Panel2: TPanel
      Left = 104
      Top = 237
      Width = 913
      Height = 41
      Caption = 'Panel2'
      TabOrder = 2
      DesignSize = (
        913
        41)
      object lcbPayer: TcxDBLookupComboBox
        Left = 5
        Top = 6
        DataBinding.DataField = 'PID'
        DataBinding.DataSource = dsPC
        ParentFont = False
        Properties.DropDownListStyle = lsEditList
        Properties.DropDownRows = 15
        Properties.KeyFieldNames = 'PID'
        Properties.ListColumns = <
          item
            Caption = #1060#1048#1054
            FieldName = 'PP'
          end
          item
            Caption = #1057#1090#1072#1090#1091#1089
            FieldName = 'SDNAME'
          end
          item
            Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076'.'
            Fixed = True
            FieldName = 'PDATEBIRTH'
          end>
        Properties.ListSource = dsPeople
        Properties.MaxLength = 0
        Properties.OnEditValueChanged = lcbPayerPropertiesEditValueChanged
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clBlack
        Style.Font.Height = -15
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 0
        OnClick = lcbPayerClick
        Width = 802
      end
      object bReload: TcxButton
        Tag = 12
        Left = 806
        Top = 6
        Width = 30
        Height = 29
        Hint = #1054#1073#1085#1086#1074#1080#1090#1100' '#1076#1072#1085#1085#1099#1077
        Anchors = [akTop, akRight]
        ParentShowHint = False
        ShowHint = True
        TabOrder = 1
        TabStop = False
        OnClick = bReloadClick
        Glyph.Data = {
          DE010000424DDE01000000000000760000002800000024000000120000000100
          0400000000006801000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333444444
          33333333333F7777773F33330000324334222222443333377F3733333377F333
          000032244222222222433337F7733FFFFF337F3300003222222AAAAA22243337
          F333F77777F337F30000322222A33333A2224337F33F7333337F337F00003222
          223333333A224337F33733333337F37F00003222222333333A444337FFFF7F33
          3337777300003AAAAAAA33333333333777777733333333330000333333333333
          333333333333333333FFFFFF000033333333333344444433FFFF333333777777
          00003A444333333A22222437777F333337F3333700003A2243333333A2222437
          F37F333333733337000033A224333334422224337337FFFFF7733337000033A2
          22444442222224337F3377777333FF370000333A2222222222AA243337FF3333
          33FF77F700003333AA222222AA33A3333377FFFFFF7733730000333333AAAAAA
          3333333333337777773333330000333333333333333333333333333333333333
          0000}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object bAddMan: TcxButton
        Tag = 12
        Left = 841
        Top = 6
        Width = 30
        Height = 27
        Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1095#1077#1083#1086#1074#1077#1082#1072
        Anchors = [akTop, akRight]
        ParentShowHint = False
        ShowHint = True
        TabOrder = 2
        TabStop = False
        OnClick = bAddManClick
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          04000000000000010000CE0E0000D80E00001000000000000000000000000000
          80000080000000808000800000008000800080800000C0C0C000808080000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333387F3333333333333333333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333387FFFFFFFFFFFFF3344444444444433387777777F777777334444444444
          4433388888887F8888883333333443333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333333333387F33333333333334433333333333333877333333333333333333
          3333333333388833333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object cxButton2: TcxButton
        Tag = 12
        Left = 876
        Top = 6
        Width = 30
        Height = 29
        Hint = #1055#1086#1080#1089#1082' '#1089#1074#1103#1079#1072#1085#1085#1086#1075#1086' '#1087#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075
        Anchors = [akTop, akRight]
        ParentShowHint = False
        ShowHint = True
        TabOrder = 3
        TabStop = False
        OnClick = cxButton2Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          80000080000000808000800000008000800080800000C0C0C000808080000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
          7777777777777777777777077777777777777787777777777777700077777777
          777778887777777777770F00077777777777878887777777777770F000777777
          77777878887777777777770F00078000877777878887F888F7777770F0008888
          807777787888FFFFF87777770007777778077777888777777F877777707777FF
          F78877777877777777FF777770777777FF707777787777777778777770777777
          7F7077777877777777787777788FF777777077777FF7777777787777788FF777
          777877777FF77777777F777778087777780777777F8F77777F87777777708888
          807777777778FFFFF877777777778000877777777777F888F777}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
    end
    object Panel3: TPanel
      Left = 103
      Top = 254
      Width = 882
      Height = 38
      Caption = 'Panel3'
      TabOrder = 3
      Visible = False
      DesignSize = (
        882
        38)
      object bAddJL: TcxButton
        Tag = 12
        Left = 804
        Top = 4
        Width = 75
        Height = 29
        Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1095#1077#1083#1086#1074#1077#1082#1072
        Anchors = [akTop, akRight]
        Caption = #1070#1088'. '#1083#1080#1094#1086
        ParentShowHint = False
        ShowHint = True
        TabOrder = 0
        TabStop = False
        Visible = False
        OnClick = bAddJLClick
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          04000000000000010000CE0E0000D80E00001000000000000000000000000000
          80000080000000808000800000008000800080800000C0C0C000808080000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333387F3333333333333333333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333387FFFFFFFFFFFFF3344444444444433387777777F777777334444444444
          4433388888887F8888883333333443333333333333387F333333333333344333
          3333333333387F3333333333333443333333333333387F333333333333344333
          3333333333387F33333333333334433333333333333877333333333333333333
          3333333333388833333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object lcbJL: TcxDBLookupComboBox
        Left = 5
        Top = 6
        DataBinding.DataField = 'JLID'
        DataBinding.DataSource = dlgDS
        ParentFont = False
        Properties.DropDownListStyle = lsEditList
        Properties.DropDownRows = 15
        Properties.KeyFieldNames = 'JLID'
        Properties.ListColumns = <
          item
            Caption = #1054#1055#1060
            MinWidth = 5
            FieldName = 'JLOPF'
          end
          item
            Caption = #1053#1072#1079#1074#1072#1085#1080#1077
            FieldName = 'JLEGALNAME'
          end
          item
            Caption = #1054#1043#1056#1053
            Fixed = True
            FieldName = 'JLOGRN'
          end
          item
            Caption = #1048#1053#1053
            FieldName = 'JLINN'
          end>
        Properties.ListFieldIndex = 1
        Properties.ListSource = dsJL
        Properties.MaxLength = 0
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clBlack
        Style.Font.Height = -15
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 1
        OnClick = lcbPayerClick
        Width = 796
      end
    end
    object lcbPoluch: TcxDBLookupComboBox
      Left = 9
      Top = 176
      DataBinding.DataField = 'PID_POLUCH'
      DataBinding.DataSource = dlgDS
      ParentFont = False
      Properties.DropDownListStyle = lsEditList
      Properties.DropDownRows = 15
      Properties.KeyFieldNames = 'PID'
      Properties.ListColumns = <
        item
          Caption = #1060#1048#1054
          FieldName = 'PP'
        end
        item
          Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076#1077#1085#1080#1103
          Fixed = True
          FieldName = 'PDATEBIRTH'
        end
        item
          Caption = #1054#1073#1088#1072#1079#1086#1074'. '#1087#1086#1076#1088#1072#1079#1076'.'
          FieldName = 'PODR'
        end>
      Properties.ListSource = dsPoluchUslug
      Properties.MaxLength = 0
      Properties.OnEditValueChanged = lcbPoluchPropertiesEditValueChanged
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clBlack
      Style.Font.Height = -15
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.Shadow = True
      Style.IsFontAssigned = True
      TabOrder = 0
      OnClick = lcbPayerClick
      Width = 984
    end
    object cxDBMemo1: TcxDBMemo
      Left = 8
      Top = 24
      TabStop = False
      DataBinding.DataField = 'BPPLAT1'
      DataBinding.DataSource = DataSourceAllPoruch
      ParentFont = False
      Properties.ReadOnly = True
      Style.Color = clMoneyGreen
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.IsFontAssigned = True
      TabOrder = 4
      Height = 65
      Width = 777
    end
    object cxDBMemo3: TcxDBMemo
      Left = 8
      Top = 102
      TabStop = False
      DataBinding.DataField = 'BPNAZNACHPLAT'
      DataBinding.DataSource = DataSourceAllPoruch
      ParentFont = False
      Properties.ReadOnly = True
      Style.Color = clMoneyGreen
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.IsFontAssigned = True
      TabOrder = 5
      Height = 54
      Width = 977
    end
    object dbgAgr: TcxGrid
      Left = 105
      Top = 301
      Width = 880
      Height = 84
      Align = alCustom
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 6
      TabStop = False
      LookAndFeel.Kind = lfStandard
      object tvAgr: TcxGridDBTableView
        NavigatorButtons.ConfirmDelete = False
        DataController.DataSource = dsAgr
        DataController.Summary.DefaultGroupSummaryItems = <>
        DataController.Summary.FooterSummaryItems = <>
        DataController.Summary.SummaryGroups = <>
        OptionsBehavior.CellHints = True
        OptionsCustomize.ColumnFiltering = False
        OptionsData.CancelOnExit = False
        OptionsData.Deleting = False
        OptionsData.DeletingConfirmation = False
        OptionsData.Editing = False
        OptionsData.Inserting = False
        OptionsView.CellEndEllipsis = True
        OptionsView.CellAutoHeight = True
        OptionsView.CellTextMaxLineCount = 1
        OptionsView.ColumnAutoWidth = True
        OptionsView.GroupByBox = False
        OptionsView.HeaderEndEllipsis = True
        Preview.Visible = True
        Styles.Background = DMInv.cxDocument
        Styles.Content = DMInv.cxDocument
        Styles.Header = DMInv.cxSiniyText
        object tvAgrP_RECIPIENT: TcxGridDBColumn
          Caption = #1055#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075
          DataBinding.FieldName = 'P_RECIPIENT'
          Width = 182
        end
        object tvAgrAGNUM_N: TcxGridDBColumn
          Caption = #1053#1086#1084#1077#1088
          DataBinding.FieldName = 'AGNUM_N'
          Width = 78
        end
        object tvAgrAGNUM: TcxGridDBColumn
          Caption = #8470' '#1085#1072' '#1076#1086#1082'.'
          DataBinding.FieldName = 'AGNUM'
          Width = 78
        end
        object tvAgrLIST: TcxGridDBColumn
          Caption = #1055#1086#1076#1087#1080#1089#1072#1085#1090#1099
          DataBinding.FieldName = 'LIST'
          Width = 77
        end
        object tvAgrAGDATEBEGIN: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1086#1076#1087'.'
          DataBinding.FieldName = 'AGDATEBEGIN'
          Width = 79
        end
        object tvAgrAGDATE: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
          DataBinding.FieldName = 'AGDATE'
          Width = 78
        end
        object tvAgrAGDATEEND: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1088#1096'.'
          DataBinding.FieldName = 'AGDATEEND'
          Width = 79
        end
        object tvAgrAGDATECLOSE: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1088#1077#1078#1076'. '#1088#1072#1089#1090#1086#1088#1078'.'
          DataBinding.FieldName = 'AGDATECLOSE'
          Width = 93
        end
        object tvAgrAGNOTECLOSE: TcxGridDBColumn
          Caption = #1055#1088#1080#1095#1080#1085#1072' '#1088#1072#1089#1090'.'
          DataBinding.FieldName = 'AGNOTECLOSE'
          Width = 77
        end
        object tvAgrAGNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGNOTE'
          Width = 79
        end
        object tvAgrISSCAN: TcxGridDBColumn
          Caption = #1050#1086#1087#1080#1103
          DataBinding.FieldName = 'ISSCAN'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 78
        end
      end
      object cxGridLevel1: TcxGridLevel
        GridView = tvAgr
      end
    end
    object cxDBMemo4: TcxDBMemo
      Left = 808
      Top = 208
      TabStop = False
      DataBinding.DataField = 'PODR'
      DataBinding.DataSource = dsPoluchUslug
      ParentFont = False
      Properties.ReadOnly = True
      Style.Color = clMoneyGreen
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.IsFontAssigned = True
      TabOrder = 7
      Height = 25
      Width = 177
    end
    object cxGroupBox1: TcxGroupBox
      Left = 1001
      Top = 8
      Caption = #1055#1086#1080#1089#1082' '#1087#1086' '#1076#1086#1075#1086#1074#1086#1088#1072#1084
      TabOrder = 8
      Height = 201
      Width = 169
      object rgAgrSearch: TcxRadioGroup
        Left = 8
        Top = 16
        Caption = #1050#1088#1080#1090#1077#1088#1080#1080
        Properties.Items = <
          item
            Caption = #8470' '#1076#1086#1075#1086#1074#1086#1088#1072
            Value = 0
          end
          item
            Caption = #8470' '#1076#1086#1075'. '#1085#1072' '#1076#1086#1082#1091#1084#1077#1085#1090#1077
            Value = 1
          end
          item
            Caption = #1044#1072#1090#1072' '#1076#1086#1075#1086#1074#1086#1088#1072
            Value = 3
          end
          item
            Caption = #1055#1086' '#1085#1086#1074#1086#1084#1091' '#1085#1086#1084#1077#1088#1091
            Value = 4
          end>
        Properties.OnChange = rgAgrSearchPropertiesChange
        ItemIndex = 1
        TabOrder = 0
        Height = 137
        Width = 153
      end
      object cxButton3: TcxButton
        Tag = 12
        Left = 132
        Top = 162
        Width = 30
        Height = 29
        Hint = #1048#1089#1082#1072#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 1
        TabStop = False
        OnClick = cxButton3Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          80000080000000808000800000008000800080800000C0C0C000808080000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
          7777777777777777777777077777777777777787777777777777700077777777
          777778887777777777770F00077777777777878887777777777770F000777777
          77777878887777777777770F00078000877777878887F888F7777770F0008888
          807777787888FFFFF87777770007777778077777888777777F877777707777FF
          F78877777877777777FF777770777777FF707777787777777778777770777777
          7F7077777877777777787777788FF777777077777FF7777777787777788FF777
          777877777FF77777777F777778087777780777777F8F77777F87777777708888
          807777777778FFFFF877777777778000877777777777F888F777}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object eText: TcxMaskEdit
        Left = 6
        Top = 162
        ParentFont = False
        Properties.MaskKind = emkRegExprEx
        Properties.EditMask = '.+'
        Properties.MaxLength = 0
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -16
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.IsFontAssigned = True
        TabOrder = 2
        Width = 121
      end
    end
  end
  object Panel5: TPanel [3]
    Left = 0
    Top = 441
    Width = 1181
    Height = 41
    Align = alTop
    TabOrder = 1
    DesignSize = (
      1181
      41)
    object Label2: TLabel
      Left = 699
      Top = 10
      Width = 116
      Height = 13
      Anchors = [akTop, akRight]
      Caption = #1044#1086#1089#1090#1091#1087#1085#1072#1103' '#1089#1091#1084#1084#1072', '#1088#1091#1073'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label1: TLabel
      Left = 947
      Top = 9
      Width = 60
      Height = 13
      Anchors = [akTop, akRight]
      Caption = #1057#1091#1084#1084#1072', '#1088#1091#1073'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object eDostupno: TcxTextEdit
      Left = 826
      Top = 6
      TabStop = False
      Anchors = [akTop, akRight]
      ParentFont = False
      Properties.ReadOnly = True
      Properties.OnChange = cxTextEdit1PropertiesChange
      Style.Color = clMoneyGreen
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.TextStyle = [fsBold]
      Style.IsFontAssigned = True
      TabOrder = 1
      Width = 112
    end
    object edCSAMOUNT: TcxDBTextEdit
      Left = 1014
      Top = 4
      Anchors = [akTop, akRight]
      DataBinding.DataField = 'CSAMOUNT'
      DataBinding.DataSource = dlgDS
      ParentFont = False
      Properties.IncrementalSearch = False
      Properties.OnEditValueChanged = edCSAMOUNTPropertiesEditValueChanged
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -19
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.Shadow = True
      Style.IsFontAssigned = True
      TabOrder = 0
      Width = 143
    end
    object cxButton1: TcxButton
      Tag = 12
      Left = 139
      Top = 1
      Width = 26
      Height = 39
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1095#1077#1083#1086#1074#1077#1082#1072
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      TabStop = False
      OnClick = cxButton1Click
      Align = alLeft
      Glyph.Data = {
        76010000424D7601000000000000760000002800000020000000100000000100
        04000000000000010000120B0000120B00001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
        33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
        FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
        FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
        FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
        FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
        FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
        C77087F7888888888FF809090000000000008787888888888888399333333333
        3333377333333333333333333333333333333333333333333333}
      LookAndFeel.SkinName = ''
      NumGlyphs = 2
    end
    object cbShowAllCS: TcxCheckBox
      Left = 1
      Top = 1
      Align = alLeft
      Caption = #1055#1086#1082#1072#1079#1072#1090#1100' '#1074#1089#1077' '#1091#1089#1083#1091#1075#1080
      Properties.OnChange = cbShowAllCSPropertiesChange
      TabOrder = 3
      Width = 138
    end
  end
  object dbgPeopleFind: TcxGrid [4]
    Left = 0
    Top = 482
    Width = 1181
    Height = 263
    Align = alClient
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -13
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 4
    LookAndFeel.Kind = lfStandard
    object tvAddCommon: TcxGridDBTableView
      NavigatorButtons.ConfirmDelete = False
      NavigatorButtons.First.Visible = True
      NavigatorButtons.PriorPage.Visible = True
      NavigatorButtons.Prior.Visible = True
      NavigatorButtons.Next.Visible = True
      NavigatorButtons.NextPage.Visible = True
      NavigatorButtons.Last.Visible = True
      NavigatorButtons.Insert.Visible = False
      NavigatorButtons.Append.Visible = False
      NavigatorButtons.Delete.Visible = False
      NavigatorButtons.Edit.Visible = False
      NavigatorButtons.Post.Visible = False
      NavigatorButtons.Cancel.Visible = False
      NavigatorButtons.Refresh.Visible = False
      NavigatorButtons.SaveBookmark.Visible = False
      NavigatorButtons.GotoBookmark.Enabled = False
      NavigatorButtons.GotoBookmark.Visible = False
      NavigatorButtons.Filter.Visible = False
      FilterBox.CustomizeDialog = False
      FilterBox.Visible = fvNever
      OnCellDblClick = tvAddCommonCellDblClick
      DataController.DataSource = dsServDolg
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'BALANCE'
          Column = tvAddCommonBALANCE
        end
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'ZAPL'
          Column = tvAddCommonZAPL
        end
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'BEZNAL'
          Column = tvAddCommonBEZNAL
        end
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'NAL'
          Column = tvAddCommonNAL
        end
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'UJE_ZAPLATILI'
          Column = tvAddCommonUJE_ZAPLATILI
        end
        item
          Format = '#,###0'
          Kind = skSum
          FieldName = 'DOLGNY_ZAPL'
          Column = tvAddCommonSCAMOUNT
        end>
      DataController.Summary.SummaryGroups = <>
      DataController.Summary.Options = [soNullIgnore]
      OptionsBehavior.CellHints = True
      OptionsBehavior.FocusFirstCellOnNewRecord = True
      OptionsBehavior.IncSearch = True
      OptionsCustomize.ColumnFiltering = False
      OptionsCustomize.ColumnGrouping = False
      OptionsData.Appending = True
      OptionsData.Deleting = False
      OptionsData.Inserting = False
      OptionsView.NavigatorOffset = 5
      OptionsView.CellAutoHeight = True
      OptionsView.CellTextMaxLineCount = 2
      OptionsView.ColumnAutoWidth = True
      OptionsView.ExpandButtonsForEmptyDetails = False
      OptionsView.Footer = True
      OptionsView.GroupByBox = False
      OptionsView.HeaderEndEllipsis = True
      OptionsView.Indicator = True
      OptionsView.ShowColumnFilterButtons = sfbAlways
      Styles.Content = DMInv.cxData
      Styles.IncSearch = DMInv.cxGreenText
      Styles.Header = DMInv.cxSiniyText
      object tvAddCommonSCNUM_N: TcxGridDBColumn
        Caption = #8470' '#1089#1082#1074#1079#1085
        DataBinding.FieldName = 'SCID'
        Options.Editing = False
        Width = 47
      end
      object tvAddCommonSTNAME: TcxGridDBColumn
        Caption = #1059#1089#1083#1091#1075#1072
        DataBinding.FieldName = 'STNAME'
        Options.Editing = False
        Width = 207
      end
      object tvAddCommonSCDATEBEGIN: TcxGridDBColumn
        Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
        DataBinding.FieldName = 'SCDATEBEGIN'
        Options.Editing = False
        Width = 47
      end
      object tvAddCommonSCDATEEND: TcxGridDBColumn
        Caption = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095'.'
        DataBinding.FieldName = 'SCDATEEND'
        Options.Editing = False
        Width = 47
      end
      object tvAddCommonSTTARIF: TcxGridDBColumn
        Caption = #1058#1072#1088#1080#1092' '#1089#1086' '#1089#1082#1080#1076#1082#1086#1081
        DataBinding.FieldName = 'SCTARIFWITHDISCOUNT'
        Options.Editing = False
        Width = 86
      end
      object tvAddCommonSKIDKA: TcxGridDBColumn
        Caption = #1057#1082#1080#1076#1082#1072
        DataBinding.FieldName = 'SKIDKA'
        Options.Editing = False
        Width = 86
      end
      object tvAddCommonTIP: TcxGridDBColumn
        Caption = #1058#1080#1087
        DataBinding.FieldName = 'TIP'
        Options.Editing = False
        Width = 42
      end
      object tvAddCommonPERIOD: TcxGridDBColumn
        Caption = #1055#1077#1088#1080#1086#1076
        DataBinding.FieldName = 'PERIOD'
        Options.Editing = False
        Width = 34
      end
      object tvAddCommonSCAMOUNT: TcxGridDBColumn
        Caption = #1055#1088#1086#1076#1072#1085#1086' '#1087#1086' '#1075#1088#1072#1092#1080#1082#1091
        DataBinding.FieldName = 'DOLGNY_ZAPL'
        Options.Editing = False
        Width = 78
      end
      object tvAddCommonNAL: TcxGridDBColumn
        Caption = #1054#1087#1083#1072#1095#1077#1085#1086' '#1053#1072#1083'.'
        DataBinding.FieldName = 'NAL'
        Options.Editing = False
        Width = 100
      end
      object tvAddCommonBEZNAL: TcxGridDBColumn
        Caption = #1054#1087#1083#1072#1095#1077#1085#1086' '#1041#1077#1079#1085#1072#1083'.'
        DataBinding.FieldName = 'BEZNAL'
        Options.Editing = False
        Width = 62
      end
      object tvAddCommonUJE_ZAPLATILI: TcxGridDBColumn
        Caption = #1042#1089#1077#1075#1086' '#1054#1087#1083#1072#1095#1077#1085#1086
        DataBinding.FieldName = 'UJE_ZAPLATILI'
        Options.Editing = False
        Width = 58
      end
      object tvAddCommonBALANCE: TcxGridDBColumn
        Caption = #1047#1072#1076#1086#1083#1078#1077#1085#1085#1086#1089#1090#1100
        DataBinding.FieldName = 'BALANCE1'
        Options.Editing = False
        Width = 56
      end
      object tvAddCommonZAPL: TcxGridDBColumn
        Caption = #1042#1085#1077#1089#1090#1080
        DataBinding.FieldName = 'ZAPL'
        PropertiesClassName = 'TcxCalcEditProperties'
        Properties.OnEditValueChanged = edCSAMOUNTPropertiesEditValueChanged
        Styles.Content = DMInv.cxJoltiyFon
        Width = 48
      end
    end
    object dbgPeopleFindLevel1: TcxGridLevel
      GridView = tvAddCommon
    end
  end
  object Panel6: TPanel [5]
    Left = 0
    Top = 745
    Width = 1181
    Height = 76
    Align = alBottom
    TabOrder = 5
    DesignSize = (
      1181
      76)
    object Label4: TLabel
      Left = 8
      Top = 7
      Width = 152
      Height = 13
      Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081' '#1082' '#1092#1072#1082#1090#1091' '#1086#1087#1083#1072#1090#1099
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object Label10: TLabel
      Left = 910
      Top = 7
      Width = 134
      Height = 13
      Anchors = [akTop, akRight]
      Caption = #1054#1089#1090#1072#1090#1086#1082' '#1086#1090' '#1087#1083#1072#1090#1077#1078#1072', '#1088#1091#1073'.'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
    end
    object cxDBMemo2: TcxDBMemo
      Left = 7
      Top = 29
      DataBinding.DataField = 'CSNOTE'
      DataBinding.DataSource = dlgDS
      ParentFont = False
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.Shadow = True
      Style.TextStyle = [fsBold]
      Style.IsFontAssigned = True
      TabOrder = 0
      Height = 31
      Width = 650
    end
    object eOstatok: TcxTextEdit
      Left = 1052
      Top = 9
      TabStop = False
      Anchors = [akTop, akRight]
      ParentFont = False
      Properties.ReadOnly = True
      Properties.OnChange = cxTextEdit1PropertiesChange
      Style.Color = clMoneyGreen
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -16
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = []
      Style.TextStyle = [fsBold]
      Style.IsFontAssigned = True
      TabOrder = 1
      Width = 112
    end
    object bResetRaznesenie: TcxButton
      Left = 1053
      Top = 43
      Width = 111
      Height = 25
      Anchors = [akTop, akRight]
      Caption = #1057#1073#1088#1086#1089' '#1088#1072#1079#1085#1077#1089#1077#1085#1080#1103
      TabOrder = 2
      OnClick = bResetRaznesenieClick
    end
  end
  object qPeople1: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterOpen = qPeople1AfterOpen
    SQL.Strings = (
      
        'SELECT P.PID, (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,' +
        #39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS PP,'
      '    SD.SDNAME, PS.SDID'
      'FROM PEOPLE P'
      'LEFT OUTER JOIN P_STATUS PS ON PS.PID = P.PID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = PS.SDID'
      'WHERE P.PISDELETE IS NULL'
      'UNION'
      'SELECT FIRST 1 NULL AS PID, NULL AS PP,'
      '    NULL AS SDNAME, NULL AS SDID'
      'FROM PEOPLE P'
      'ORDER BY 2')
    Left = 392
    Top = 285
    object qPeople1PID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPeople1PP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qPeople1SDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPeople1SDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"P_STATUS"."SDID"'
    end
  end
  object dsPeople: TDataSource
    DataSet = qPeople1
    Left = 360
    Top = 285
  end
  object qPC: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qPCAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT PC.*'
      'FROM PEOPLE_COMMON PC'
      'WHERE PC.CSID = :CSID')
    UpdateObject = quPC
    Left = 464
    Top = 285
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'CSID'
        ParamType = ptUnknown
      end>
    object qPCPID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE_COMMON"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPCCSID: TIntegerField
      FieldName = 'CSID'
      Origin = '"PEOPLE_COMMON"."CSID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
  end
  object dsPC: TDataSource
    DataSet = qPC
    Left = 432
    Top = 285
  end
  object quPC: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  PID,'
      '  CSID'
      'from PEOPLE_COMMON '
      'where'
      '  CSID = :CSID and'
      '  PID = :PID')
    ModifySQL.Strings = (
      'update PEOPLE_COMMON'
      'set'
      '  PID = :PID'
      'where'
      '  CSID = :OLD_CSID')
    InsertSQL.Strings = (
      'insert into PEOPLE_COMMON'
      '  (CSID, PID)'
      'values'
      '  (:CSID, :PID)')
    DeleteSQL.Strings = (
      'delete from PEOPLE_COMMON'
      'where'
      '  CSID = :OLD_CSID and'
      '  PID = :OLD_PID')
    Left = 496
    Top = 282
  end
  object qJL: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT J.*'
      'FROM JURLITSA J'
      'where J.JLISDELETE is null')
    Left = 840
    Top = 288
    object qJLJLID: TIntegerField
      FieldName = 'JLID'
      Origin = '"JURLITSA"."JLID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qJLJLEGALNAME: TIBStringField
      DisplayWidth = 15
      FieldName = 'JLEGALNAME'
      Origin = '"JURLITSA"."JLEGALNAME"'
      Size = 255
    end
    object qJLJLNOTE: TIBStringField
      FieldName = 'JLNOTE'
      Origin = '"JURLITSA"."JLNOTE"'
      Size = 255
    end
    object qJLJLUSERENTER: TIBStringField
      FieldName = 'JLUSERENTER'
      Origin = '"JURLITSA"."JLUSERENTER"'
      Size = 40
    end
    object qJLJLTIMEENTER: TDateTimeField
      FieldName = 'JLTIMEENTER'
      Origin = '"JURLITSA"."JLTIMEENTER"'
    end
    object qJLJLUSEREDIT: TIBStringField
      FieldName = 'JLUSEREDIT'
      Origin = '"JURLITSA"."JLUSEREDIT"'
      Size = 40
    end
    object qJLJLTIMEEDIT: TDateTimeField
      FieldName = 'JLTIMEEDIT'
      Origin = '"JURLITSA"."JLTIMEEDIT"'
    end
    object qJLJLINN: TIBStringField
      DisplayWidth = 12
      FieldName = 'JLINN'
      Origin = '"JURLITSA"."JLINN"'
      Size = 12
    end
    object qJLJLOGRN: TIBStringField
      DisplayWidth = 12
      FieldName = 'JLOGRN'
      Origin = '"JURLITSA"."JLOGRN"'
      Size = 255
    end
    object qJLJLOPF: TIBStringField
      DisplayWidth = 5
      FieldName = 'JLOPF'
      Origin = '"JURLITSA"."JLOPF"'
      Size = 10
    end
    object qJLJLLEGALADRESS: TIBStringField
      DisplayWidth = 15
      FieldName = 'JLLEGALADRESS'
      Origin = '"JURLITSA"."JLLEGALADRESS"'
      Size = 255
    end
    object qJLJLCEONAME: TIBStringField
      FieldName = 'JLCEONAME'
      Origin = '"JURLITSA"."JLCEONAME"'
      Size = 255
    end
  end
  object dsJL: TDataSource
    DataSet = qJL
    Left = 808
    Top = 288
  end
  object dsServDolg: TDataSource
    DataSet = qServDolg
    Left = 1008
    Top = 528
  end
  object quServDolg: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  STNAME,'
      '  SCID,'
      '  SCNUM_N,'
      '  AGID,'
      '  SCNUMBER,'
      '  SCDATE,'
      '  SCDATEEND,'
      '  SCNOTE,'
      '  SCISDELETE,'
      '  SCISNEEDRESIGN,'
      '  SCUSERENTER,'
      '  SCTIMEENTER,'
      '  SCUSEREDIT,'
      '  SCTIMEEDIT,'
      '  SCDATEREGISTER,'
      '  SCUSERREGISTER,'
      '  SCDISCOUNT,'
      '  SCTYPEOFDISCOUNT,'
      '  SCDISCOUNTNOTE,'
      '  SCDISCOUNTAUTORISATION,'
      '  SCMINPERIOD,'
      '  SCTYPEOFDISC,'
      '  SCDATEBEGIN,'
      '  SCTARIF,'
      '  SCTARIFWITHDISCOUNT,'
      '  SCAMOUNT,'
      '  SCBALANCE,'
      '  BALANCE,'
      '  ZAPL'
      'from SPEC_COND '
      'where'
      '  AGID = :AGID')
    ModifySQL.Strings = (
      'update SPEC_COND'
      'set'
      '  AGID = :AGID,'
      '  BALANCE = :BALANCE,'
      '  SCAMOUNT = :SCAMOUNT,'
      '  SCBALANCE = :SCBALANCE,'
      '  SCDATE = :SCDATE,'
      '  SCDATEBEGIN = :SCDATEBEGIN,'
      '  SCDATEEND = :SCDATEEND,'
      '  SCDATEREGISTER = :SCDATEREGISTER,'
      '  SCDISCOUNT = :SCDISCOUNT,'
      '  SCDISCOUNTAUTORISATION = :SCDISCOUNTAUTORISATION,'
      '  SCDISCOUNTNOTE = :SCDISCOUNTNOTE,'
      '  SCID = :SCID,'
      '  SCISDELETE = :SCISDELETE,'
      '  SCISNEEDRESIGN = :SCISNEEDRESIGN,'
      '  SCMINPERIOD = :SCMINPERIOD,'
      '  SCNOTE = :SCNOTE,'
      '  SCNUM_N = :SCNUM_N,'
      '  SCNUMBER = :SCNUMBER,'
      '  SCTARIF = :SCTARIF,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      '  SCTIMEEDIT = :SCTIMEEDIT,'
      '  SCTIMEENTER = :SCTIMEENTER,'
      '  SCTYPEOFDISC = :SCTYPEOFDISC,'
      '  SCTYPEOFDISCOUNT = :SCTYPEOFDISCOUNT,'
      '  SCUSEREDIT = :SCUSEREDIT,'
      '  SCUSERENTER = :SCUSERENTER,'
      '  SCUSERREGISTER = :SCUSERREGISTER,'
      '  STNAME = :STNAME,'
      '  ZAPL = :ZAPL'
      'where'
      '  AGID = :OLD_AGID')
    InsertSQL.Strings = (
      'insert into SPEC_COND'
      
        '  (AGID, BALANCE, SCAMOUNT, SCBALANCE, SCDATE, SCDATEBEGIN, SCDA' +
        'TEEND, '
      
        '   SCDATEREGISTER, SCDISCOUNT, SCDISCOUNTAUTORISATION, SCDISCOUN' +
        'TNOTE, '
      
        '   SCID, SCISDELETE, SCISNEEDRESIGN, SCMINPERIOD, SCNOTE, SCNUM_' +
        'N, SCNUMBER, '
      
        '   SCTARIF, SCTARIFWITHDISCOUNT, SCTIMEEDIT, SCTIMEENTER, SCTYPE' +
        'OFDISC, '
      
        '   SCTYPEOFDISCOUNT, SCUSEREDIT, SCUSERENTER, SCUSERREGISTER, ST' +
        'NAME, ZAPL)'
      'values'
      
        '  (:AGID, :BALANCE, :SCAMOUNT, :SCBALANCE, :SCDATE, :SCDATEBEGIN' +
        ', :SCDATEEND, '
      
        '   :SCDATEREGISTER, :SCDISCOUNT, :SCDISCOUNTAUTORISATION, :SCDIS' +
        'COUNTNOTE, '
      
        '   :SCID, :SCISDELETE, :SCISNEEDRESIGN, :SCMINPERIOD, :SCNOTE, :' +
        'SCNUM_N, '
      
        '   :SCNUMBER, :SCTARIF, :SCTARIFWITHDISCOUNT, :SCTIMEEDIT, :SCTI' +
        'MEENTER, '
      
        '   :SCTYPEOFDISC, :SCTYPEOFDISCOUNT, :SCUSEREDIT, :SCUSERENTER, ' +
        ':SCUSERREGISTER, '
      '   :STNAME, :ZAPL)')
    DeleteSQL.Strings = (
      'null;')
    Left = 1072
    Top = 533
  end
  object qCommons: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qCommonsAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT *'
      'FROM COMMON C'
      'WHERE C.CSID = :CSID')
    UpdateObject = quCommons
    GeneratorField.Field = 'CID'
    GeneratorField.Generator = 'GEN_COMMON_ID'
    Left = 1040
    Top = 568
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'CSID'
        ParamType = ptUnknown
      end>
    object qCommonsCID: TIntegerField
      FieldName = 'CID'
      Origin = '"COMMON"."CID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qCommonsCSID: TIntegerField
      FieldName = 'CSID'
      Origin = '"COMMON"."CSID"'
    end
    object qCommonsCTYPE: TIntegerField
      FieldName = 'CTYPE'
      Origin = '"COMMON"."CTYPE"'
    end
    object qCommonsCAMOUNT: TIBBCDField
      FieldName = 'CAMOUNT'
      Origin = '"COMMON"."CAMOUNT"'
      Precision = 18
      Size = 2
    end
    object qCommonsCID_CORRECT: TIntegerField
      FieldName = 'CID_CORRECT'
      Origin = '"COMMON"."CID_CORRECT"'
    end
    object qCommonsCDATE: TDateField
      FieldName = 'CDATE'
      Origin = '"COMMON"."CDATE"'
    end
    object qCommonsCUSERENTER: TIBStringField
      FieldName = 'CUSERENTER'
      Origin = '"COMMON"."CUSERENTER"'
      Size = 40
    end
    object qCommonsCTIMEENTER: TDateTimeField
      FieldName = 'CTIMEENTER'
      Origin = '"COMMON"."CTIMEENTER"'
    end
    object qCommonsCUSEREDIT: TIBStringField
      FieldName = 'CUSEREDIT'
      Origin = '"COMMON"."CUSEREDIT"'
      Size = 40
    end
    object qCommonsCTIMEEDIT: TDateTimeField
      FieldName = 'CTIMEEDIT'
      Origin = '"COMMON"."CTIMEEDIT"'
    end
    object qCommonsSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"COMMON"."SCID"'
    end
  end
  object quCommons: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  CID,'
      '  CSID,'
      '  CTYPE,'
      '  CAMOUNT,'
      '  CID_CORRECT,'
      '  CDATE,'
      '  CUSERENTER,'
      '  CTIMEENTER,'
      '  CUSEREDIT,'
      '  CTIMEEDIT,'
      '  SCID'
      'from COMMON '
      'where'
      '  CID = :CID')
    ModifySQL.Strings = (
      'update COMMON'
      'set'
      '  CAMOUNT = :CAMOUNT,'
      '  CDATE = :CDATE,'
      '  CID = :CID,'
      '  CID_CORRECT = :CID_CORRECT,'
      '  CSID = :CSID,'
      '  CTIMEEDIT = :CTIMEEDIT,'
      '  CTIMEENTER = :CTIMEENTER,'
      '  CTYPE = :CTYPE,'
      '  CUSEREDIT = :CUSEREDIT,'
      '  CUSERENTER = :CUSERENTER,'
      '  SCID = :SCID'
      'where'
      '  CID = :OLD_CID')
    InsertSQL.Strings = (
      'insert into COMMON'
      
        '  (CAMOUNT, CDATE, CID, CID_CORRECT, CSID, CTIMEEDIT, CTIMEENTER' +
        ', CTYPE, '
      '   CUSEREDIT, CUSERENTER, SCID)'
      'values'
      
        '  (:CAMOUNT, :CDATE, :CID, :CID_CORRECT, :CSID, :CTIMEEDIT, :CTI' +
        'MEENTER, '
      '   :CTYPE, :CUSEREDIT, :CUSERENTER, :SCID)')
    DeleteSQL.Strings = (
      'null;')
    Left = 1072
    Top = 569
  end
  object dsPoluchUslug: TDataSource
    DataSet = qPoluchUslug
    Left = 256
    Top = 216
  end
  object qPoluchUslug: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT P.PID, (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,' +
        #39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS PP,'
      '    SD.SDNAME, sd1.SDNAME AS podr, P.PDATEBIRTH'
      'FROM PEOPLE P'
      'LEFT OUTER JOIN P_STATUS PS ON PS.PID = P.PID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DA' +
        'TE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATE' +
        'OUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP.SDID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = PS.SDID'
      'WHERE P.PISDELETE IS NULL'
      '    AND PS.SDID in (1246, 1801) '
      'UNION'
      'SELECT FIRST 1 CAST('#39'-1'#39' AS INTEGER) AS PID, '#39' '#39' AS PP,'
      '    '#39' '#39' AS  SDNAME, '#39' '#39' AS podr, NULL AS PDATEBIRTH'
      'FROM PEOPLE P'
      'ORDER BY 2')
    Left = 288
    Top = 217
    object qPoluchUslugPID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPoluchUslugPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qPoluchUslugSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPoluchUslugPODR: TIBStringField
      FieldName = 'PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPoluchUslugPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
  end
  object qServDolg: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    BeforePost = qServDolgBeforePost
    CachedUpdates = True
    DataSource = dsPoluchUslug
    SQL.Strings = (
      'SELECT ST.STNAME, S.SID, SC.SCID,'
      '       SC.SCNUM_N, SC.SCDATEBEGIN, SC.SCDATEEND,'
      
        '       SC.SCTARIFWITHDISCOUNT, ST.STTARIF, (ST.STTARIF - SC.SCTA' +
        'RIFWITHDISCOUNT) AS skidka,'
      '       CASE ST.STTYPE'
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39
      '       END AS tip,'
      '       IIF (ST.STTYPE <> 0,'
      '       CASE ST.STPERIODOPLATY'
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39
      '       WHEN 1 THEN '#39#1050#1074#1072#1088#1090#1072#1083#39
      '       END, '#39#1053#1077#1090#39') AS period,'
      
        '       CAST(COALESCE(SCPD.dolgny_zapl, 0) AS NUMERIC(18,0)) AS d' +
        'olgny_zapl,'
      
        'CAST ((COALESCE(SCPD.dolgny_zapl, 0) - COALESCE(SCPD1.zapl1,0) -' +
        ' COALESCE(SCPD2.zapl1,0)) AS NUMERIC(18,0))  AS balance,'
      
        'CAST ((COALESCE(SCPD.dolgny_zapl, 0) - COALESCE(SCPD1.zapl1,0) -' +
        ' COALESCE(SCPD2.zapl1,0)) AS NUMERIC(18,0)) AS balance1,'
      
        'CAST('#39'0'#39' AS INTEGER) AS zapl, COALESCE(SCPD1.zapl1,0) AS nal, CO' +
        'ALESCE(SCPD2.zapl1,0) AS beznal,'
      
        '(COALESCE(SCPD1.zapl1,0) + COALESCE(SCPD2.zapl1,0)) AS uje_zapla' +
        'tili'
      'FROM SPEC_COND SC'
      'LEFT OUTER JOIN'
      '('
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.GPDATE <= CURRENT_DATE'
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT COM.SCID, SUM(COM.CAMOUNT) AS zapl1'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'WHERE CS.CSISDELETE IS NULL'
      '    AND CS.PID_POLUCH = :PID'
      '    AND CS.CSFORM = 0'
      '    AND COM.CTYPE < 2'
      'GROUP BY 1'
      ') AS SCPD1 ON SCPD1.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT COM.SCID, SUM(COM.CAMOUNT) AS zapl1'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'WHERE CS.CSISDELETE IS NULL'
      '    AND CS.PID_POLUCH = :PID'
      '    AND CS.CSFORM = 1'
      '    AND COM.CTYPE < 2'
      'GROUP BY 1'
      ') AS SCPD2 ON SCPD2.SCID = SC.SCID'
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'WHERE SC.SCISDELETE IS NULL'
      '    AND APU.PID = :PID'
      '    AND A.AGISDELETE IS NULL'
      'ORDER BY 1')
    UpdateObject = quServDolg
    Left = 1040
    Top = 528
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qServDolgSTNAME: TIBStringField
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qServDolgSID: TIntegerField
      FieldName = 'SID'
      Origin = '"SERVICES"."SID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qServDolgSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qServDolgSCDATEEND: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object qServDolgSCDATEBEGIN: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object qServDolgSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qServDolgZAPL: TIntegerField
      FieldName = 'ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      EditFormat = '0'
    end
    object qServDolgSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object qServDolgSTTARIF: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      Required = True
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qServDolgSKIDKA: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qServDolgTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object qServDolgPERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 7
    end
    object qServDolgDOLGNY_ZAPL: TLargeintField
      FieldName = 'DOLGNY_ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
    end
    object qServDolgBALANCE: TLargeintField
      FieldName = 'BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
    end
    object qServDolgBALANCE1: TLargeintField
      FieldName = 'BALANCE1'
      ProviderFlags = []
      DisplayFormat = '#,###0'
    end
    object qServDolgNAL: TIBBCDField
      FieldName = 'NAL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qServDolgBEZNAL: TIBBCDField
      FieldName = 'BEZNAL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qServDolgUJE_ZAPLATILI: TIBBCDField
      FieldName = 'UJE_ZAPLATILI'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
  end
  object DataSourceAllPoruch: TDataSource
    Left = 296
  end
  object qAgr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsPeople
    SQL.Strings = (
      'SELECT UN.*, LIST(UN.podp, '#39', '#39')'
      'FROM'
      '('
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA,'
      
        '    CAST( LIST(DISTINCT (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESC' +
        'E(P.PPATRONYMIC,'#39' '#39')), '#39', '#39') AS VARCHAR(2048)) AS podp'
      'FROM AGREEMENTS A'
      'INNER JOIN'
      '('
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID'
      'UNION'
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'WHERE AP.PID = :PID'
      ') AS AG1 ON AG1.AGID = A.AGID'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P ON P.PID = AP.PID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      'WHERE a.AGISDELETE IS NULL '
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2, 23'
      'UNION'
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA, AP.ID_JURIDICAL_FACE'
      'FROM AGREEMENTS A'
      'INNER JOIN'
      '('
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID'
      'UNION'
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'WHERE AP.PID = :PID'
      ') AS AG1 ON AG1.AGID = A.AGID'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      
        'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID AND AP.POTYPE = ' +
        '1'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      'WHERE a.AGISDELETE IS NULL'
      ''
      ') AS UN'
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2,23,24')
    GeneratorField.Field = 'AGID'
    Left = 179
    Top = 371
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qAgrAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qAgrAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      Origin = '"AGREEMENTS"."AGNUM_N"'
    end
    object qAgrAGNUM: TIBStringField
      FieldName = 'AGNUM'
      Origin = '"AGREEMENTS"."AGNUM"'
      Size = 40
    end
    object qAgrAGDATE: TDateField
      FieldName = 'AGDATE'
      Origin = '"AGREEMENTS"."AGDATE"'
    end
    object qAgrAGDATEEND: TDateField
      FieldName = 'AGDATEEND'
      Origin = '"AGREEMENTS"."AGDATEEND"'
    end
    object qAgrAGFORMTYPE: TIntegerField
      FieldName = 'AGFORMTYPE'
      Origin = '"AGREEMENTS"."AGFORMTYPE"'
    end
    object qAgrAGNOTE: TIBStringField
      FieldName = 'AGNOTE'
      Origin = '"AGREEMENTS"."AGNOTE"'
      Size = 255
    end
    object qAgrAGDATECLOSE: TDateField
      FieldName = 'AGDATECLOSE'
      Origin = '"AGREEMENTS"."AGDATECLOSE"'
    end
    object qAgrAGNOTECLOSE: TIBStringField
      FieldName = 'AGNOTECLOSE'
      Origin = '"AGREEMENTS"."AGNOTECLOSE"'
      Size = 255
    end
    object qAgrAGUSERENTER: TIBStringField
      FieldName = 'AGUSERENTER'
      Origin = '"AGREEMENTS"."AGUSERENTER"'
      Size = 40
    end
    object qAgrAGTIMEENTER: TDateTimeField
      FieldName = 'AGTIMEENTER'
      Origin = '"AGREEMENTS"."AGTIMEENTER"'
    end
    object qAgrAGUSEREDIT: TIBStringField
      FieldName = 'AGUSEREDIT'
      Origin = '"AGREEMENTS"."AGUSEREDIT"'
      Size = 40
    end
    object qAgrAGTIMEEDIT: TDateTimeField
      FieldName = 'AGTIMEEDIT'
      Origin = '"AGREEMENTS"."AGTIMEEDIT"'
    end
    object qAgrAGISDELETE: TIntegerField
      FieldName = 'AGISDELETE'
      Origin = '"AGREEMENTS"."AGISDELETE"'
    end
    object qAgrP_RECIPIENT: TIBStringField
      FieldName = 'P_RECIPIENT'
      ProviderFlags = []
      Size = 767
    end
    object qAgrISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qAgrPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qAgrFORMA: TIBStringField
      FieldName = 'FORMA'
      ProviderFlags = []
      Size = 255
    end
    object qAgrLIST: TMemoField
      FieldName = 'LIST'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
    object qAgrAGUSERREGISTER: TIBStringField
      FieldName = 'AGUSERREGISTER'
      Origin = '"AGREEMENTS"."AGUSERREGISTER"'
      Size = 40
    end
    object qAgrAGDATEREGISTER: TDateTimeField
      FieldName = 'AGDATEREGISTER'
      Origin = '"AGREEMENTS"."AGDATEREGISTER"'
    end
    object qAgrAGISNEEDRESIGN: TIntegerField
      FieldName = 'AGISNEEDRESIGN'
      Origin = '"AGREEMENTS"."AGISNEEDRESIGN"'
    end
    object qAgrAGPODRTYPE: TIntegerField
      FieldName = 'AGPODRTYPE'
      Origin = '"AGREEMENTS"."AGPODRTYPE"'
    end
    object qAgrAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      ProviderFlags = []
    end
    object qAgrPODP: TIBStringField
      FieldName = 'PODP'
      ProviderFlags = []
      Size = 2048
    end
  end
  object dsAgr: TDataSource
    DataSet = qAgr
    Left = 147
    Top = 371
  end
  object qAgrPU: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsPoluchUslug
    SQL.Strings = (
      'SELECT UN.*, LIST(UN.podp, '#39', '#39')'
      'FROM'
      '('
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA,'
      
        '    CAST( LIST(DISTINCT (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESC' +
        'E(P.PPATRONYMIC,'#39' '#39')), '#39', '#39') AS VARCHAR(2048)) AS podp'
      'FROM AGREEMENTS A'
      'INNER JOIN'
      '('
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID'
      'UNION'
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'WHERE AP.PID = :PID'
      ') AS AG1 ON AG1.AGID = A.AGID'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P ON P.PID = AP.PID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      'WHERE a.AGISDELETE IS NULL '
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2, 23'
      'UNION'
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH,'
      '     SD.SDNAME AS FORMA, AP.ID_JURIDICAL_FACE'
      'FROM AGREEMENTS A'
      'INNER JOIN'
      '('
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID'
      'UNION'
      'SELECT A.AGID'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'WHERE AP.PID = :PID'
      ') AS AG1 ON AG1.AGID = A.AGID'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID'
      
        'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID AND AP.POTYPE = ' +
        '1'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE'
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID'
      'WHERE a.AGISDELETE IS NULL'
      ''
      ') AS UN'
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2,23,24')
    GeneratorField.Field = 'AGID'
    Left = 248
    Top = 520
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qAgrPUAGID: TIntegerField
      FieldName = 'AGID'
      ProviderFlags = []
    end
    object qAgrPUAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      ProviderFlags = []
    end
    object qAgrPUAGNUM: TIBStringField
      FieldName = 'AGNUM'
      ProviderFlags = []
      Size = 40
    end
    object qAgrPUAGDATE: TDateField
      FieldName = 'AGDATE'
      ProviderFlags = []
    end
    object qAgrPUAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      ProviderFlags = []
    end
    object qAgrPUAGDATEEND: TDateField
      FieldName = 'AGDATEEND'
      ProviderFlags = []
    end
    object qAgrPUAGFORMTYPE: TIntegerField
      FieldName = 'AGFORMTYPE'
      ProviderFlags = []
    end
    object qAgrPUAGNOTE: TIBStringField
      FieldName = 'AGNOTE'
      ProviderFlags = []
      Size = 255
    end
    object qAgrPUAGDATECLOSE: TDateField
      FieldName = 'AGDATECLOSE'
      ProviderFlags = []
    end
    object qAgrPUAGNOTECLOSE: TIBStringField
      FieldName = 'AGNOTECLOSE'
      ProviderFlags = []
      Size = 255
    end
    object qAgrPUAGISNEEDRESIGN: TIntegerField
      FieldName = 'AGISNEEDRESIGN'
      ProviderFlags = []
    end
    object qAgrPUAGISDELETE: TIntegerField
      FieldName = 'AGISDELETE'
      ProviderFlags = []
    end
    object qAgrPUAGUSERENTER: TIBStringField
      FieldName = 'AGUSERENTER'
      ProviderFlags = []
      Size = 40
    end
    object qAgrPUAGTIMEENTER: TDateTimeField
      FieldName = 'AGTIMEENTER'
      ProviderFlags = []
    end
    object qAgrPUAGUSEREDIT: TIBStringField
      FieldName = 'AGUSEREDIT'
      ProviderFlags = []
      Size = 40
    end
    object qAgrPUAGTIMEEDIT: TDateTimeField
      FieldName = 'AGTIMEEDIT'
      ProviderFlags = []
    end
    object qAgrPUAGUSERREGISTER: TIBStringField
      FieldName = 'AGUSERREGISTER'
      ProviderFlags = []
      Size = 40
    end
    object qAgrPUAGDATEREGISTER: TDateTimeField
      FieldName = 'AGDATEREGISTER'
      ProviderFlags = []
    end
    object qAgrPUAGPODRTYPE: TIntegerField
      FieldName = 'AGPODRTYPE'
      ProviderFlags = []
    end
    object qAgrPUP_RECIPIENT: TIBStringField
      FieldName = 'P_RECIPIENT'
      ProviderFlags = []
      Size = 767
    end
    object qAgrPUISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qAgrPUPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      ProviderFlags = []
    end
    object qAgrPUFORMA: TIBStringField
      FieldName = 'FORMA'
      ProviderFlags = []
      Size = 255
    end
    object qAgrPUPODP: TIBStringField
      FieldName = 'PODP'
      ProviderFlags = []
      Size = 2048
    end
    object qAgrPULIST: TMemoField
      FieldName = 'LIST'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object qFindPU: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsPeople
    SQL.Strings = (
      
        'SELECT LIST( (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39 +
        ' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39'))||'#39'('#39'||COALESCE(sd1.sdname' +
        ','#39' '#39')||'#39')'#39', '#39';'#39') AS pu'
      'FROM P_REL PR'
      'INNER JOIN PEOPLE P ON P.PID = PR.PID'
      'LEFT OUTER JOIN P_STATUS PS ON PS.PID = P.PID'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DA' +
        'TE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATE' +
        'OUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = DP.SDID'
      'WHERE'
      'PR.PID_GROUP = ('
      'SELECT DISTINCT PR1.PID_GROUP'
      'FROM P_REL PR1'
      'WHERE PR1.PID = :PID'
      ')'
      'and P.PISDELETE IS NULL AND PS.SDID = 1246')
    Left = 1000
    Top = 309
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qFindPUPU: TMemoField
      FieldName = 'PU'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object qAgrFind: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT LIST( '#39#1055#1086#1083#1091#1095'. - '#39'||(COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COAL' +
        'ESCE(P1.PNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39'))||'#39' '#1055#1086#1076#1087'.-' +
        #39'||'
      
        '(COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')||'#39' '#39'||C' +
        'OALESCE(P2.PPATRONYMIC,'#39' '#39')), '#39' ; '#39') AS spisok'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'INNER JOIN PEOPLE p1 ON p1.PID = APU.PID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE p2 ON p2.PID = AP.PID'
      'WHERE UPPER(A.AGNUM) CONTAINING UPPER(:text)')
    Left = 1136
    Top = 117
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'text'
        ParamType = ptUnknown
      end>
    object qAgrFindSPISOK: TMemoField
      FieldName = 'SPISOK'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object sqlCopyToTemp: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'INSERT INTO COMMON_TEMP'
      'SELECT C.*'
      'FROM COMMON C'
      'WHERE C.CSID = :CSID')
    Transaction = DMInv.IBTransaction1
    Left = 400
    Top = 8
  end
  object sqlDelFromCommon: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'DELETE FROM COMMON C'
      'WHERE C.CSID = :CSID')
    Transaction = DMInv.IBTransaction1
    Left = 440
    Top = 8
  end
  object sqlCancelToCommon: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'INSERT INTO COMMON'
      'SELECT CT.*'
      'FROM COMMON_TEMP CT'
      'WHERE CT.CSID = :CSID')
    Transaction = DMInv.IBTransaction1
    Left = 480
    Top = 8
  end
  object qOldRaznesenie: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT CT.*'
      'FROM COMMON_TEMP CT'
      'WHERE CT.CSID = :CSID')
    Left = 520
    Top = 8
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'CSID'
        ParamType = ptUnknown
      end>
    object qOldRaznesenieCID: TIntegerField
      FieldName = 'CID'
      Origin = '"COMMON_TEMP"."CID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qOldRaznesenieCSID: TIntegerField
      FieldName = 'CSID'
      Origin = '"COMMON_TEMP"."CSID"'
    end
    object qOldRaznesenieCTYPE: TIntegerField
      FieldName = 'CTYPE'
      Origin = '"COMMON_TEMP"."CTYPE"'
    end
    object qOldRaznesenieCAMOUNT: TIBBCDField
      FieldName = 'CAMOUNT'
      Origin = '"COMMON_TEMP"."CAMOUNT"'
      Precision = 18
      Size = 2
    end
    object qOldRaznesenieCID_CORRECT: TIntegerField
      FieldName = 'CID_CORRECT'
      Origin = '"COMMON_TEMP"."CID_CORRECT"'
    end
    object qOldRaznesenieCDATE: TDateField
      FieldName = 'CDATE'
      Origin = '"COMMON_TEMP"."CDATE"'
    end
    object qOldRaznesenieCUSERENTER: TIBStringField
      FieldName = 'CUSERENTER'
      Origin = '"COMMON_TEMP"."CUSERENTER"'
      Size = 40
    end
    object qOldRaznesenieCTIMEENTER: TDateTimeField
      FieldName = 'CTIMEENTER'
      Origin = '"COMMON_TEMP"."CTIMEENTER"'
    end
    object qOldRaznesenieCUSEREDIT: TIBStringField
      FieldName = 'CUSEREDIT'
      Origin = '"COMMON_TEMP"."CUSEREDIT"'
      Size = 40
    end
    object qOldRaznesenieCTIMEEDIT: TDateTimeField
      FieldName = 'CTIMEEDIT'
      Origin = '"COMMON_TEMP"."CTIMEEDIT"'
    end
    object qOldRaznesenieSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"COMMON_TEMP"."SCID"'
    end
  end
  object sqlClearCommonTemp: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'DELETE FROM COMMON_TEMP CT'
      'WHERE CT.CSID = :CSID')
    Transaction = DMInv.IBTransaction1
    Left = 560
    Top = 8
  end
  object qDolg: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'EXECUTE PROCEDURE SP_BALANCE (:PID)')
    Transaction = DMInv.IBTransaction1
    Left = 1104
    Top = 325
  end
  object qServDolgTemp: TIBQuery
    SQL.Strings = (
      'SELECT ST.STNAME, S.SID, SC.SCID,'
      '       SC.SCNUM_N, SC.SCDATEBEGIN, SC.SCDATEEND,'
      
        '       SC.SCTARIFWITHDISCOUNT, ST.STTARIF, (ST.STTARIF - SC.SCTA' +
        'RIFWITHDISCOUNT) AS skidka,'
      '       CASE ST.STTYPE'
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39
      '       END AS tip,'
      '       IIF (ST.STTYPE <> 0,'
      '       CASE ST.STPERIODOPLATY'
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39
      '       WHEN 1 THEN '#39#1050#1074#1072#1088#1090#1072#1083#39
      '       END, '#39#1053#1077#1090#39') AS period,'
      
        '       CAST(COALESCE(SCPD.dolgny_zapl, 0) AS NUMERIC(18,0)) AS d' +
        'olgny_zapl,'
      
        'CAST ((COALESCE(SCPD.dolgny_zapl, 0) - COALESCE(SCPD1.zapl1,0) -' +
        ' COALESCE(SCPD2.zapl1,0)) AS NUMERIC(18,0))  AS balance,'
      
        'CAST ((COALESCE(SCPD.dolgny_zapl, 0) - COALESCE(SCPD1.zapl1,0) -' +
        ' COALESCE(SCPD2.zapl1,0)) AS NUMERIC(18,0)) AS balance1,'
      
        'CAST('#39'0'#39' AS INTEGER) AS zapl, COALESCE(SCPD1.zapl1,0) AS nal, CO' +
        'ALESCE(SCPD2.zapl1,0) AS beznal,'
      
        '(COALESCE(SCPD1.zapl1,0) + COALESCE(SCPD2.zapl1,0)) AS uje_zapla' +
        'tili'
      'FROM SPEC_COND SC'
      'LEFT OUTER JOIN'
      '('
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.GPDATE <= CURRENT_DATE'
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT COM.SCID, SUM(COM.CAMOUNT) AS zapl1'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'WHERE CS.CSISDELETE IS NULL'
      '    AND CS.PID_POLUCH = :PID'
      '    AND CS.CSFORM = 0'
      '    AND COM.CTYPE < 2'
      'GROUP BY 1'
      ') AS SCPD1 ON SCPD1.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT COM.SCID, SUM(COM.CAMOUNT) AS zapl1'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'WHERE CS.CSISDELETE IS NULL'
      '    AND CS.PID_POLUCH = :PID'
      '    AND CS.CSFORM = 1'
      '    AND COM.CTYPE < 2'
      'GROUP BY 1'
      ') AS SCPD2 ON SCPD2.SCID = SC.SCID'
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'WHERE SC.SCISDELETE IS NULL'
      '    AND APU.PID = :PID'
      '    AND A.AGISDELETE IS NULL')
    Left = 1046
    Top = 496
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
  end
  object dsSpecCond: TDataSource
    DataSet = qSpecCond
    Left = 272
    Top = 624
  end
  object qSpecCond: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    DataSource = dsAgr
    SQL.Strings = (
      
        'SELECT SC.*, IIF (S.SCID IS NULL, 0, 1) AS ISSCAN, SD.SDNAME AS ' +
        'actualn, '
      
        '    STP.*, SER.*, IIF (stp.STPERIODOPLATY = 1,'#39#1059#1095#1077#1073#1085#1099#1081' '#1090#1088#1080#1084#1077#1089#1090#1088'.' +
        #39', '#39#1052#1077#1089#1103#1094'.'#39') AS minperiod, SD_edizmer.SDNAME AS edizme, '
      
        '    CAST(IIF (A.AGPODRTYPE = 0, '#39#1042#1086#1089#1087#1080#1090#1072#1085#1085#1080#1082#39', '#39#1059#1095#1077#1085#1080#1082#39') AS VARC' +
        'HAR(20)) AS vospit, '
      '    CASE STP.STTYPE '
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39' '
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39' '
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39' '
      '    END AS tip, '
      '       cast( IIF (STP.STTYPE <> 0, '
      '       CASE STP.STPERIODOPLATY '
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39' '
      '       WHEN 1 THEN '#39#1059#1095#1077#1073#1085#1099#1081' '#1090#1088#1080#1084#1077#1089#1090#1088#39' '
      '       END, '#39#1053#1077#1090#39') as varchar(50)) AS period, '
      
        '    SCPD.dolgny_zapl, (STP.STTARIF - SC.SCTARIFWITHDISCOUNT) AS ' +
        'skidka, '
      
        '    (COALESCE(SCPD.dolgny_zapl,0) - COALESCE(ZBB.zaplbb,0)) AS b' +
        'alance, '
      
        '    p1.PLASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||' +
        ' '
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'. '#39','#39' '#39') AS au' +
        'tor, COALESCE(ZBB.zaplbb,0) AS zapl_all, '
      
        'IIF (coalesce(SC.SCTIMEEDIT, current_timestamp - 36500) > coales' +
        'ce(SER.STIMEEDIT, current_timestamp - 36500), (p3.PLASTNAME||'#39' '#39 +
        '||SUBSTRING(p3.PNAME FROM 1 FOR 1 )||'#39'. '#39'|| '
      
        'COALESCE(SUBSTRING(p3.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39')), (p2.' +
        'PLASTNAME||'#39' '#39'||SUBSTRING(p2.PNAME FROM 1 FOR 1 )||'#39'. '#39'|| '
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39'))) AS e' +
        'dit_user, '
      'EXTRACT (YEAR FROM SC.SCDATEEND) AS SCY, '
      
        'IIF (coalesce(SC.SCTIMEEDIT, current_timestamp - 36500) > coales' +
        'ce(SER.STIMEEDIT, current_timestamp - 36500), SC.SCTIMEEDIT, SER' +
        '.STIMEEDIT) AS time_edit, COALESCE(SC.SCAPPROVED,1) AS SCAPPROVE' +
        'D1 '
      'FROM SPEC_COND SC '
      'LEFT OUTER JOIN SERVICES SER ON SER.SCID = SC.SCID '
      'LEFT OUTER JOIN SERVICES_TYPE STP ON STP.STID = SER.STID '
      'LEFT OUTER JOIN SC_SCAN S ON S.SCID = SC.SCID '
      'LEFT OUTER JOIN SCACTUALN SCA ON SCA.SCID = SC.SCID '
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = SCA.SDID '
      
        'LEFT OUTER JOIN SYS_DIC SD_edizmer ON SD_edizmer.SDID = STP.STED' +
        'IZMER '
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      'LEFT OUTER JOIN USERS U ON U.USNAME = SC.SCUSERENTER '
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID '
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = SER.SUSEREDIT '
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U1.PID '
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSEREDIT '
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U2.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'WHERE (GP.GPDATE <= CURRENT_DATE) '
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT SC1.SCID, SUM(COM.CAMOUNT) AS zaplbb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = COM.SCID '
      'WHERE CS.CSISDELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      '     AND SC1.AGID = :AGID '
      'GROUP BY 1 '
      ') AS ZBB ON ZBB.SCID = SC.SCID '
      'WHERE SC.AGID = :AGID '
      'AND SC.SCISDELETE IS NULL '
      'order by SC.SCNUM_N ')
    UpdateObject = quSpecCond
    GeneratorField.Field = 'SCID'
    GeneratorField.Generator = 'GEN_SPEC_COND'
    Left = 304
    Top = 624
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object qSpecCondSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qSpecCondSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object qSpecCondAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"SPEC_COND"."AGID"'
      Required = True
    end
    object qSpecCondSCNUMBER: TIBStringField
      FieldName = 'SCNUMBER'
      Origin = '"SPEC_COND"."SCNUMBER"'
      Size = 40
    end
    object qSpecCondSCDATE: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object qSpecCondSCDATEEND: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object qSpecCondSCNOTE: TIBStringField
      FieldName = 'SCNOTE'
      Origin = '"SPEC_COND"."SCNOTE"'
      Size = 255
    end
    object qSpecCondSCUSERENTER: TIBStringField
      FieldName = 'SCUSERENTER'
      Origin = '"SPEC_COND"."SCUSERENTER"'
      Size = 40
    end
    object qSpecCondSCTIMEENTER: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object qSpecCondSCUSEREDIT: TIBStringField
      FieldName = 'SCUSEREDIT'
      Origin = '"SPEC_COND"."SCUSEREDIT"'
      Size = 40
    end
    object qSpecCondSCTIMEEDIT: TDateTimeField
      FieldName = 'SCTIMEEDIT'
      Origin = '"SPEC_COND"."SCTIMEEDIT"'
    end
    object qSpecCondSCISDELETE: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object qSpecCondISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qSpecCondSCDISCOUNTAUTORISATION: TIBStringField
      FieldName = 'SCDISCOUNTAUTORISATION'
      Origin = '"SPEC_COND"."SCDISCOUNTAUTORISATION"'
      Size = 40
    end
    object qSpecCondSCDATEREGISTER: TDateTimeField
      FieldName = 'SCDATEREGISTER'
      Origin = '"SPEC_COND"."SCDATEREGISTER"'
    end
    object qSpecCondSCUSERREGISTER: TIBStringField
      FieldName = 'SCUSERREGISTER'
      Origin = '"SPEC_COND"."SCUSERREGISTER"'
      Size = 40
    end
    object qSpecCondSCDISCOUNT: TIBBCDField
      FieldName = 'SCDISCOUNT'
      Origin = '"SPEC_COND"."SCDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTYPEOFDISCOUNT: TIntegerField
      FieldName = 'SCTYPEOFDISCOUNT'
      Origin = '"SPEC_COND"."SCTYPEOFDISCOUNT"'
    end
    object qSpecCondSCISNEEDRESIGN: TIntegerField
      FieldName = 'SCISNEEDRESIGN'
      Origin = '"SPEC_COND"."SCISNEEDRESIGN"'
    end
    object qSpecCondSCDISCOUNTNOTE: TIBStringField
      FieldName = 'SCDISCOUNTNOTE'
      Origin = '"SPEC_COND"."SCDISCOUNTNOTE"'
      Size = 255
    end
    object qSpecCondACTUALN: TIBStringField
      FieldName = 'ACTUALN'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTYPEOFDISC: TIntegerField
      FieldName = 'SCTYPEOFDISC'
      Origin = '"SPEC_COND"."SCTYPEOFDISC"'
    end
    object qSpecCondSTID: TIntegerField
      FieldName = 'STID'
      Origin = '"SERVICES_TYPE"."STID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qSpecCondSTNAME: TIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qSpecCondSTTYPE: TIntegerField
      FieldName = 'STTYPE'
      Origin = '"SERVICES_TYPE"."STTYPE"'
    end
    object qSpecCondSTEDIZMER: TIntegerField
      FieldName = 'STEDIZMER'
      Origin = '"SERVICES_TYPE"."STEDIZMER"'
    end
    object qSpecCondSTDESCR: TIBStringField
      FieldName = 'STDESCR'
      Origin = '"SERVICES_TYPE"."STDESCR"'
      Size = 2048
    end
    object qSpecCondSTTARIF: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSTDATEBEGIN: TDateField
      FieldName = 'STDATEBEGIN'
      Origin = '"SERVICES_TYPE"."STDATEBEGIN"'
    end
    object qSpecCondSTDATEEND: TDateField
      FieldName = 'STDATEEND'
      Origin = '"SERVICES_TYPE"."STDATEEND"'
    end
    object qSpecCondSTTIME: TTimeField
      FieldName = 'STTIME'
      Origin = '"SERVICES_TYPE"."STTIME"'
    end
    object qSpecCondSTPODRTYPE: TIntegerField
      FieldName = 'STPODRTYPE'
      Origin = '"SERVICES_TYPE"."STPODRTYPE"'
    end
    object qSpecCondSTNOTE: TIBStringField
      FieldName = 'STNOTE'
      Origin = '"SERVICES_TYPE"."STNOTE"'
      Size = 255
    end
    object qSpecCondSTISARCHIVE: TIntegerField
      FieldName = 'STISARCHIVE'
      Origin = '"SERVICES_TYPE"."STISARCHIVE"'
    end
    object qSpecCondSTISDELETE: TIntegerField
      FieldName = 'STISDELETE'
      Origin = '"SERVICES_TYPE"."STISDELETE"'
    end
    object qSpecCondSTUSERENTER: TIBStringField
      FieldName = 'STUSERENTER'
      Origin = '"SERVICES_TYPE"."STUSERENTER"'
      Size = 40
    end
    object qSpecCondSTTIMEENTER: TDateTimeField
      FieldName = 'STTIMEENTER'
      Origin = '"SERVICES_TYPE"."STTIMEENTER"'
    end
    object qSpecCondSTUSEREDIT: TIBStringField
      FieldName = 'STUSEREDIT'
      Origin = '"SERVICES_TYPE"."STUSEREDIT"'
      Size = 40
    end
    object qSpecCondSTTIMEEDIT: TDateTimeField
      FieldName = 'STTIMEEDIT'
      Origin = '"SERVICES_TYPE"."STTIMEEDIT"'
    end
    object qSpecCondSCDATEBEGIN: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object qSpecCondSNOTE: TIBStringField
      FieldName = 'SNOTE'
      Origin = '"SERVICES"."SNOTE"'
      Size = 255
    end
    object qSpecCondSTIMEBEGIN: TTimeField
      FieldName = 'STIMEBEGIN'
      Origin = '"SERVICES"."STIMEBEGIN"'
    end
    object qSpecCondSTIMEEND: TTimeField
      FieldName = 'STIMEEND'
      Origin = '"SERVICES"."STIMEEND"'
    end
    object qSpecCondSCMINPERIOD: TIntegerField
      FieldName = 'SCMINPERIOD'
      Origin = '"SPEC_COND"."SCMINPERIOD"'
    end
    object qSpecCondSCOUNT: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object qSpecCondEDIZME: TIBStringField
      FieldName = 'EDIZME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTARIF: TIBBCDField
      FieldName = 'SCTARIF'
      Origin = '"SPEC_COND"."SCTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCAMOUNT: TIBBCDField
      FieldName = 'SCAMOUNT'
      Origin = '"SPEC_COND"."SCAMOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCBALANCE: TIBBCDField
      FieldName = 'SCBALANCE'
      Origin = '"SPEC_COND"."SCBALANCE"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCDATARASCH: TIntegerField
      FieldName = 'SCDATARASCH'
      Origin = '"SPEC_COND"."SCDATARASCH"'
    end
    object qSpecCondVOSPIT: TIBStringField
      FieldName = 'VOSPIT'
      ProviderFlags = []
      FixedChar = True
      Size = 11
    end
    object qSpecCondSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"SERVICES_TYPE"."SDID"'
    end
    object qSpecCondTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object qSpecCondDOLGNY_ZAPL: TIBBCDField
      FieldName = 'DOLGNY_ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSKIDKA: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondBALANCE: TIBBCDField
      FieldName = 'BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondAUTOR: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondSCDATERASTORJ: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object qSpecCondZAPL_ALL: TIBBCDField
      FieldName = 'ZAPL_ALL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondEDIT_USER: TIBStringField
      FieldName = 'EDIT_USER'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondMINPERIOD: TIBStringField
      FieldName = 'MINPERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 22
    end
    object qSpecCondPOID: TIntegerField
      FieldName = 'POID'
      Origin = '"SPEC_COND"."POID"'
    end
    object qSpecCondPERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 50
    end
    object qSpecCondSCISGRAFEDIT: TIntegerField
      FieldName = 'SCISGRAFEDIT'
      Origin = '"SPEC_COND"."SCISGRAFEDIT"'
    end
    object qSpecCondSCY: TSmallintField
      FieldName = 'SCY'
      ProviderFlags = []
    end
    object qSpecCondTIME_EDIT: TDateTimeField
      FieldName = 'TIME_EDIT'
      ProviderFlags = []
    end
    object qSpecCondSCAPPROVED1: TIntegerField
      FieldName = 'SCAPPROVED1'
      ProviderFlags = []
    end
    object qSpecCondSCAPPROVED: TIntegerField
      FieldName = 'SCAPPROVED'
      Origin = '"SPEC_COND"."SCAPPROVED"'
    end
    object qSpecCondSCUSERAPPROVED: TIBStringField
      FieldName = 'SCUSERAPPROVED'
      Origin = '"SPEC_COND"."SCUSERAPPROVED"'
      Size = 40
    end
    object qSpecCondSTSYSPODR: TIntegerField
      FieldName = 'STSYSPODR'
      Origin = '"SERVICES_TYPE"."STSYSPODR"'
    end
  end
  object quSpecCond: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  SCID,'
      '  SCNUM_N,'
      '  AGID,'
      '  SCNUMBER,'
      '  SCDATE,'
      '  SCDATEEND,'
      '  SCNOTE,'
      '  SCISDELETE,'
      '  SCISNEEDRESIGN,'
      '  SCUSERENTER,'
      '  SCTIMEENTER,'
      '  SCUSEREDIT,'
      '  SCTIMEEDIT,'
      '  SCDATEREGISTER,'
      '  SCUSERREGISTER,'
      '  SCDISCOUNT,'
      '  SCTYPEOFDISCOUNT,'
      '  SCDISCOUNTNOTE,'
      '  SCDISCOUNTAUTORISATION,'
      '  SCTYPEOFDISC,'
      '  SCDATEBEGIN,'
      '  SCMINPERIOD,'
      '  SCTARIF,'
      '  SCTARIFWITHDISCOUNT,'
      '  SCAMOUNT,'
      '  SCBALANCE,'
      '  SCDATARASCH,'
      '  SCDATERASTORJ,'
      '  POID,'
      '  SCISGRAFEDIT,'
      '  ISSCAN,'
      '  ACTUALN,'
      '  STID,'
      '  STNAME,'
      '  STTYPE,'
      '  STEDIZMER,'
      '  STDESCR,'
      '  STTARIF,'
      '  STDATEBEGIN,'
      '  STDATEEND,'
      '  STTIME,'
      '  STNOTE,'
      '  STISDELETE,'
      '  STUSERENTER,'
      '  STTIMEENTER,'
      '  STUSEREDIT,'
      '  STTIMEEDIT,'
      '  STPODRTYPE,'
      '  STISARCHIVE,'
      '  STPODR,'
      '  STPERIODOPLATY,'
      '  SDID,'
      '  SID,'
      '  SCID1,'
      '  STID1,'
      '  SCOUNT,'
      '  SNOTE,'
      '  STIMEBEGIN,'
      '  STIMEEND,'
      '  SUSERENTER,'
      '  STIMEENTER,'
      '  SUSEREDIT,'
      '  STIMEEDIT,'
      '  SISDELETE,'
      '  MINPERIOD,'
      '  EDIZME,'
      '  VOSPIT,'
      '  TIP,'
      '  PERIOD,'
      '  DOLGNY_ZAPL,'
      '  SKIDKA,'
      '  BALANCE,'
      '  AUTOR,'
      '  ZAPL_ALL,'
      '  EDIT_USER, '
      'SCAPPROVED'
      'from SPEC_COND '
      'where'
      '  SCID = :SCID')
    ModifySQL.Strings = (
      'update SPEC_COND'
      'set'
      '  AGID = :AGID,'
      '  POID = :POID,'
      '  SCAMOUNT = :SCAMOUNT,'
      '  SCBALANCE = :SCBALANCE,'
      '  SCDATARASCH = :SCDATARASCH,'
      '  SCDATE = :SCDATE,'
      '  SCDATEBEGIN = :SCDATEBEGIN,'
      '  SCDATEEND = :SCDATEEND,'
      '  SCDATERASTORJ = :SCDATERASTORJ,'
      '  SCDATEREGISTER = :SCDATEREGISTER,'
      '  SCDISCOUNT = :SCDISCOUNT,'
      '  SCDISCOUNTAUTORISATION = :SCDISCOUNTAUTORISATION,'
      '  SCDISCOUNTNOTE = :SCDISCOUNTNOTE,'
      '  SCID = :SCID,'
      '  SCISDELETE = :SCISDELETE,'
      '  SCISGRAFEDIT = :SCISGRAFEDIT,'
      '  SCISNEEDRESIGN = :SCISNEEDRESIGN,'
      '  SCMINPERIOD = :SCMINPERIOD,'
      '  SCNOTE = :SCNOTE,'
      '  SCNUM_N = :SCNUM_N,'
      '  SCNUMBER = :SCNUMBER,'
      '  SCTARIF = :SCTARIF,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      ''
      '  SCTYPEOFDISC = :SCTYPEOFDISC,'
      '  SCTYPEOFDISCOUNT = :SCTYPEOFDISCOUNT,'
      ''
      '  SCUSERREGISTER = :SCUSERREGISTER, '
      'SCAPPROVED = :SCAPPROVED'
      'where'
      '  SCID = :OLD_SCID')
    InsertSQL.Strings = (
      'insert into SPEC_COND'
      
        '  (AGID, POID, SCAMOUNT, SCBALANCE, SCDATARASCH, SCDATE, SCDATEB' +
        'EGIN, SCDATEEND, '
      
        '   SCDATERASTORJ, SCDATEREGISTER, SCDISCOUNT, SCDISCOUNTAUTORISA' +
        'TION, SCDISCOUNTNOTE, '
      
        '   SCID, SCISDELETE, SCISGRAFEDIT, SCISNEEDRESIGN, SCMINPERIOD, ' +
        'SCNOTE, '
      '   SCNUM_N, SCNUMBER, SCTARIF, SCTARIFWITHDISCOUNT, '
      '   SCTYPEOFDISC, SCTYPEOFDISCOUNT,  SCUSERREGISTER, SCAPPROVED)'
      'values'
      
        '  (:AGID, :POID, :SCAMOUNT, :SCBALANCE, :SCDATARASCH, :SCDATE, :' +
        'SCDATEBEGIN, '
      
        '   :SCDATEEND, :SCDATERASTORJ, :SCDATEREGISTER, :SCDISCOUNT, :SC' +
        'DISCOUNTAUTORISATION, '
      
        '   :SCDISCOUNTNOTE, :SCID, :SCISDELETE, :SCISGRAFEDIT, :SCISNEED' +
        'RESIGN, '
      
        '   :SCMINPERIOD, :SCNOTE, :SCNUM_N, :SCNUMBER, :SCTARIF, :SCTARI' +
        'FWITHDISCOUNT, '
      
        '    :SCTYPEOFDISC, :SCTYPEOFDISCOUNT, :SCUSERREGISTER, :SCAPPROV' +
        'ED)')
    DeleteSQL.Strings = (
      'update SPEC_COND'
      'set'
      '  SCISDELETE = 1'
      'where'
      '  SCID = :OLD_SCID')
    Left = 347
    Top = 624
  end
end
